/**
 * Copyrigth 2007 Aurelien Moreau
 * 
 * This file is part of ProcessShop.
 * 
 * ProcessShop is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * ProcessShop is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with ProcessShop; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * $Id$
 */
package net.yienyien.process.dfm4bpmn.impl;

import net.yienyien.process.bpd.BPDModel;
import net.yienyien.process.bpd.BPDObject;
import net.yienyien.process.bpd.Task;


import net.yienyien.process.dfm4bpmn.DataActivity;
import net.yienyien.process.dfm4bpmn.DataFlow;
import net.yienyien.process.dfm4bpmn.Dfm4bpmnPackage;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.stp.bpmn.Activity;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Data Flow</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * </p>
 *
 * @generated
 */
public class DataFlowImpl extends net.yienyien.process.dfm.impl.DataFlowImpl implements DataFlow {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected DataFlowImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Dfm4bpmnPackage.Literals.DATA_FLOW;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public void fixDfmRef(BPDModel bpdModel) {
		for(net.yienyien.process.dfm.DataActivity da :getDataActivities()) {
			da.setObject(find(bpdModel, ((DataActivity)da).getActivity()));
		}
	}

	private BPDObject find(BPDModel model, Activity act) {
		for(BPDObject o: model.getObjects()) {
			if(act.equals(o.getFrom())) {
				return o;
			}
		}
		return null;
	}
	
} //DataFlowImpl
